package com.mayikt.mapper;

import com.mayikt.entity.UserEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author: BuMingBo
 * @ClassName: UserMapper
 * @create: 2022-05-16 01:02
 * Version: 1.0
 */

@Mapper
public interface UserMapper {

    @Insert("INSERT INTO USERS VALUES(null, #{userName}, #{age})")
    int insertUser(@Param("userName") String userName, @Param("age") Integer age);

    @Select("SELECT id as id, name as userName, age as age FROM USERS WHERE id = #{id}")
    UserEntity selectByUserId(@Param("id") Integer id);
}
